package com.uphone.magicleafteacher.pro.activity.guidancetest;

import android.view.View;

import com.uphone.magicleafteacher.MyApp;
import com.uphone.magicleafteacher.base.BaseListActivity;
import com.uphone.magicleafteacher.http.ApiService;
import com.uphone.magicleafteacher.pro.activity.RehearsalActivity;
import com.uphone.magicleafteacher.pro.adapter.GuidancetestAdapyer;
import com.uphone.magicleafteacher.util.CommonUtil;
import com.uphone.magicleafteacher.util.GsonUtils;
import com.uphone.magicleafteacher.vo.RepeatDataBean;

import java.util.List;

import io.reactivex.Observable;
import okhttp3.ResponseBody;

public class GuidancetestActivity extends BaseListActivity<RepeatDataBean.RepeatDataListBean, GuidancetestAdapyer> {

    @Override
    protected Observable<ResponseBody> loadData(ApiService apiService) {
        return MyApp.apiService(ApiService.class)
                .repeatDataList(CommonUtil.getTeacherId(), page + "", "10");
    }

    @Override
    protected List<RepeatDataBean.RepeatDataListBean> getDataList(String json) {
        RepeatDataBean bean = GsonUtils.getGson().fromJson(json, RepeatDataBean.class);
        if (bean != null)
            return bean.getRepeatDataList();
        return null;
    }

    @Override
    protected void itemClick(GuidancetestAdapyer adapter, View view, int position) {
        CommonUtil.startIntent(this, RehearsalActivity.class, mAdapter.getItem(position).getRepeatId());
    }

    @Override
    protected GuidancetestAdapyer initAdapter() {
        return new GuidancetestAdapyer();
    }

    @Override
    protected void initBundle() {

    }

    @Override
    protected void initTitle() {
        initTitle("复述批改");

    }
}
